package com.hzf.config.rpc.service.impl;

import com.hzf.config.dao.mapper.ConfigGztypeMapper;
import com.hzf.config.dao.mapper.ConfigPtanliMapper;
import com.hzf.config.dao.mapper.ConfigRegionMapper;
import com.hzf.config.dao.mapper.ConfigStyleMapper;
import com.hzf.config.dao.model.*;
import com.hzf.config.rpc.api.ConfigApiService;
import com.hzf.config.rpc.api.ConfigRegionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
@Transactional
public class ConfigApiServiceImpl implements ConfigApiService {
    @Autowired
    ConfigRegionMapper configRegionMapper;
    @Autowired
    ConfigStyleMapper configStyleMapper;
    @Autowired
    ConfigPtanliMapper configPtanliMapper;
    @Autowired
    ConfigGztypeMapper configGztypeMapper;
    @Override
    public List<ConfigRegion> selectByExample(ConfigRegionExample example) {
        return configRegionMapper.selectByExample(example);
    }

    @Override
    public ConfigRegion selectAddressRegion(ConfigRegionExample example) {
        List<ConfigRegion> list = configRegionMapper.selectByExample(example);
        if (null != list && list.size() > 0) {
            return list.get(0);
        }
        return null;
    }

    @Override
    public List<ConfigStyle> selectByConfigStyleExample(ConfigStyleExample example) {
        return configStyleMapper.selectByExample(example);
    }

    @Override
    public ConfigStyle selectConfigStyleRegion(ConfigStyleExample example) {
        List<ConfigStyle> list =configStyleMapper.selectByExample(example);
        if(null!=list&&0!=list.size()){
            return list.get(0);
        }
        return null;
    }
    @Override
    public List<ConfigPtanli> selectConfigPtanliExample(ConfigPtanliExample example) {
        return configPtanliMapper.selectByExample(example);
    }

    @Override
    public ConfigPtanli selectConfigPtanliRegion(ConfigPtanliExample example) {
        List<ConfigPtanli> list =configPtanliMapper.selectByExample(example);
        if(null!=list&&0!=list.size()){
            return list.get(0);
        }
        return null;
    }
    @Override
    public List<ConfigGztype> selectConfigPtanliExample(ConfigGztypeExample example) {
        return configGztypeMapper.selectByExample(example);
    }

    @Override
    public ConfigGztype selectConfigGztype(ConfigGztypeExample example) {
        List<ConfigGztype> list =configGztypeMapper.selectByExample(example);
        if(null!=list&&0!=list.size()){
            return list.get(0);
        }
        return null;
    }
}
